package lection.lab.springbootlab.controller;

import lection.lab.springbootlab.model.Person;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/hello")
public class HelloController {

    @RequestMapping(value = "/hi", method = RequestMethod.GET)
    public String hello() {
        return "Hello world.";
    }

    @RequestMapping(value = "/path-value/{val}", method = RequestMethod.GET)
    public String pathValue(
            @PathVariable String val, Person person) {
        return "Hello " + val + ".Your name is " + person.getName() + ".";
    }

}
